<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<#include "../common/head.ftl">

<body class="gray-bg">
<#include "../common/modal.ftl">

<#include "../common/delete.ftl">

<#include "../common/entity.ftl">

<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-content" id="search">
                    <div class="search-box">
                        设备标识：
                        <div><input type="search" name="accessKey"></div>
                        管理员：
                        <div><input type="search" name="managerName"></div>
                        设备名称：
                        <div><input type="search" name="deviceName"></div>
                        设备类别：
                        <div><input type="text" name="deviceType"></div>
                        <button class='btn btn-search'>搜索</button>
                    </div>
                    <div class='hr'></div>
                    <div class='top_row'>
                        <button type="button" id="add" class="btn btn-default btn-success"
                                style="color: #fff;background-color: #398439; border-color: #255625;">添加设备
                        </button>
                        <div class="pull-right page">
                            每页显示:<span class='page_active'>10</span><span>20</span><span>30</span><span>40</span><span>50</span>
                        </div>
                    </div>
                    <table class="table table-striped table-bordered table-hover dataTables-example">
                        <thead>
                        <tr>
                            <th name="id" style="display:none;">id</th>
                            <th name="accessKey">设备标识</th>
                            <th name="managerName">管理员</th>
                            <th name="deviceName">设备名称</th>
                            <th name="deviceDescribe">设备描述</th>
                            <th name="deviceStatus">设备状态</th>
                            <th name="deviceType">设备类别</th>
                            <th name="">功能选项</th>
                        </tr>
                        </thead>
                        <tbody></tbody>
                    </table>
                    <div class="paging"></div>
                </div>
            </div>
        </div>
    </div>
</div>

<script src="${basePath}/js/jquery.min.js?v=2.1.4"></script>
<script src="${basePath}/js/page.js"></script>
<script src="${basePath}/js/common.js"></script>
<script src="${basePath}/js/bootstrap.min.js?v=3.3.6"></script>
<script type="text/javascript">
    var table = initTable("${basePath}/root/findDeviceList", "search", $("table"), "paging");
    EditEntity("编辑设备", "添加设备", $("table"), $("#add"),
            "${basePath}/root/deviceForm",
            "${basePath}/root/findDeviceById",
            "${basePath}/root/updateDevice",
            "${basePath}/root/deleteDeviceById",
            table.search);
    $("table").on("click", "tbody td a:first-child", function () {
        $('#EditEntity').find(".managerName").show();
        $('#EditEntity').find("[name='managerName']").prop("disabled", true);
        $('#EditEntity').find(".deviceStatus").show();
        $('#EditEntity').find("[name='deviceStatus']").prop("disabled", true);

        $("#EditEntity").find(".hardver").hide();
        $("#EditEntity").find(".progVer").hide();
    })
    $("#add").click(function () {
        $('#EditEntity').find(".managerName").hide();
        $('#EditEntity').find("[name='managerName']").val("");
        $('#EditEntity').find(".deviceStatus").hide();
        $('#EditEntity').find("[name='deviceStatus']").val("");

        $("#EditEntity").find(".hardver").show();
        $("#EditEntity").find(".progVer").show();
    })
</script>

</body>
</html>